home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15501 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  52 lines

  1. Path: grimsel.zurich.ibm.com!usenet
  2. From: wgk@zurich.ibm.com (Keith Whittingham)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Assembly and Turbo C++?
  5. Date: 6 Apr 1996 10:31:18 GMT
  6. Organization: IBM Research, ZRH
  7. Message-ID: <4k5h5m$tfv@grimsel.zurich.ibm.com>
  8. References: <31657857.1950825@news.lafn.org>
  9. Reply-To: wgk@zurich.ibm.com
  10. NNTP-Posting-Host: pine.zurich.ibm.com
  11. X-Newsreader: IBM NewsReader/2 v1.00
  12.  
  13. In <31657857.1950825@news.lafn.org>, ay011@lafn.org (Danny Yoo) writes:
  14. >    I'm trying to learn more about sprite programming/animation.
  15. >I've picked up a book, "Zen of Graphics Programming" by Michael
  16. >Abrash.  Opening the tome up, I realize: I don't know how to use
  17. >assembly!  I'm using Turbo C++ 3.0 (ugh) and I'm planning to get 5.0,
  18.  
  19. Don't dispair, I'm using 3.1 and it's fine for the job...
  20.  
  21. If you type (in an edit window) asm and hit the Ctrl-F1 it'll tell
  22. you all you need to do. You can do either of the following:
  23.  
  24. main()
  25.   {
  26. asm     mov     ax,bx
  27. asm     inc     ax     // Etc.
  28.   int i;
  29. asm {
  30.   xor ax,ax
  31.   mov i,ax      
  32. }      
  33.   printf("%d\n", i);
  34.   }
  35.  
  36. Which is pretty neat all in all. It's a hell of a lot easier than
  37. calling assembler from C or vice versa.
  38.  
  39. Assembler is quite easy to understand until you have to start
  40. messing around with Intel architecture which is a mess and 
  41. as fast as I understand one chip they keep bringing out a 
  42. new one.
  43.  
  44. As a rule of thumb try and convert as much as you can to C/C++
  45. except anything you need to be really fast. Don't corrupt
  46. registers you shouldn't, I only change ax,bx,cx,dx and flags
  47. anything else is pushed and popped.
  48.  
  49. Keith
  50.  
  51.  
  52.